<?php $this->header(); ?>
<div class="wrap">
    <?php include 'Setting_nav.php'; ?>
    <div class="h_a">提示</div>
    <div class="mb10 prompt_text">
        <ol>
            <li>如果系统内置的变量不满足，可以通过这次进行扩展。前台调用方式为 <b class="red">$system[键名]</b></li>
        </ol>
    </div>
    <div class="h_a">内容值</div>
    <form class="J_ajaxForm" action="<?php echo $func->url('Admin-Setting-updateExpand'); ?>" method="post">
        <div class="table_full">
            <table width="100%">
                <thead>
                    <tr>
                        <td>键名</td>
                        <td>值</td>
                        <td>操作</td>
                    </tr>
                </thead>
                <?php foreach ($list as $key => $value): ?>
                    <tr class="<?php echo $key; ?>">
                        <td><input type="text" class="input length_5" name="key[]" value="<?php echo $key; ?>"></td>
                        <td><input type="text" class="input length_5" name="value[]" value="<?php echo $value; ?>"></td>
                        <td>
                            <a href="javascript:;" class="btn btn_submit J_ajax_submit_btn delete" >删除</a>
                        </td>
                    </tr>
                <?php endforeach; ?>
                <tr class="empty_expand">
                    <td><input type="text" class="input length_5" name="key[]" value=""></td>
                    <td><input type="text" class="input length_5" name="value[]" value=""></td>
                    <td>
                        <a href="javascript:;" class="btn btn_submit J_ajax_submit_btn addexpand" >追加</a>
                        <a href="javascript:;" class="btn btn_submit J_ajax_submit_btn delete" >删除</a>
                    </td>
                </tr>
            </table>
        </div>
        <div class="btn_wrap">
            <div class="btn_wrap_pd">
                <button class="btn btn_submit J_ajax_submit_btn" type="submit">提交</button>
            </div>
        </div>
    </form>
</div>
<script>
    uetjs.setting = function() {
        $(function() {
            $(".addexpand").live('click', function() {
                $(".empty_expand").after($(".empty_expand").eq(0).clone());
                $(".empty_expand").each(function(index) {
                    if (index > 0) {
                        $(".empty_expand").eq(index).removeClass().attr("class", "empty_expand" + index);
                        $(".empty_expand input").val("");
                    }

                })
            })
            $(".delete").live('click', function() {
                var name = ($(this).parent()).parent();
                $(name[0]).remove();
            })
        })
    }
</script>
<?php $this->footer(); ?>